#!/bin/bash

set -e

function checkout() {
  repo=$1; url=$2; sha=$3

  if [ ! -d "$repo" ]; then
    git clone "https://github.com/$url" "$repo"
  fi

  pushd "$repo"
  git fetch && git reset --hard "$sha"
  popd
}

checkout examples/Newtonsoft.Json JamesNK/Newtonsoft.Json 7c3d7f8da7e35dde8fa74188b0decff70f8f10e3
checkout examples/nunit           nunit/nunit             ad49f27294bd0f2677d8699756c6ccb10df600f8
checkout examples/orchard         OrchardCMS/orchard      0a82721968232b07354edcaac63a9ccea02220c6
